﻿<%@ Page Title="Home Page" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false"
    CodeBehind="Default.aspx.vb" Inherits="mybaconrecipe._Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">

<div id="lhsPaneWide">

    <h1>
        Our Latest Bacon Delicacies
    </h1>

    <div class="slider-wrapper theme-default bannerPadding">
    <div class="ribbon"></div>
    <div id="slider" class="nivoSlider">
        <asp:HyperLink ID="hypBnrImage1" runat="server"><asp:Image ID="bnrImage1" runat="server" width="577px" height="382px" /></asp:HyperLink>
        <asp:HyperLink ID="hypBnrImage2" runat="server"><asp:Image ID="bnrImage2" runat="server" width="577px" height="382px" /></asp:HyperLink>
        <asp:HyperLink ID="hypBnrImage3" runat="server"><asp:Image ID="bnrImage3" runat="server" width="577px" height="382px" /></asp:HyperLink>
        <asp:HyperLink ID="hypBnrImage4" runat="server"><asp:Image ID="bnrImage4" runat="server" width="577px" height="382px" /></asp:HyperLink>
        <asp:HyperLink ID="hypBnrImage5" runat="server"><asp:Image ID="bnrImage5" runat="server" width="577px" height="382px" /></asp:HyperLink>
    </div>
    </div>


<script type="text/javascript">
    $(window).load(function () {
        $('#slider').nivoSlider();
    });
</script>

<h2 class="lessTopPadding">Our Highest Rated Greasies!</h2>
    <asp:ListView ID="lstHighestRated" runat="server" 
        DataSourceID="HighestRatedSqlDataSource" GroupItemCount="4">
        <AlternatingItemTemplate>
            <td id="Td1" runat="server" class="homePageTopRatedContainer">
                <table cellpadding="0" cellspacing="0" class="homePageTopRated">
                <tr>
                <td class="homePageTopRatedImg"><a href='<%# DataBinder.Eval(Container.DataItem, "RECIPE_ID", "RecipeDetail.aspx?ID={0}") %>'>
                            <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("REC_IMAGE") %>' CssClass="RecListThumb" /></a></td>
                </tr>
                <tr>
                <td class="homePageTopRatedRecName"><a href='<%# DataBinder.Eval(Container.DataItem, "RECIPE_ID", "RecipeDetail.aspx?ID={0}") %>'>
                            <%# DataBinder.Eval(Container.DataItem, "REC_NAME") %></a></td>
                </tr>
                <tr>
                <td class="homePageTopRatedStars"><asp:Image ID="RecListStarsImage" runat="server" ImageUrl='<%# getBaconStars(Eval("AverageRating"))%>'
                            ToolTip='<%# "Rated: " & DataBinder.Eval(Container.DataItem, "AverageRating", "{0:0.00}") & " Bacon Strips" %>' /></td>
                </tr>
                </table>
            </td>
        </AlternatingItemTemplate>
        <EditItemTemplate>
            <td id="Td2" runat="server" class="homePageTopRatedContainer">
                <table cellpadding="0" cellspacing="0" class="homePageTopRated">
                <tr>
                <td class="homePageTopRatedImg"><a href='<%# DataBinder.Eval(Container.DataItem, "RECIPE_ID", "RecipeDetail.aspx?ID={0}") %>'>
                            <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("REC_IMAGE") %>' CssClass="RecListThumb" /></a></td>
                </tr>
                <tr>
                <td class="homePageTopRatedRecName"><a href='<%# DataBinder.Eval(Container.DataItem, "RECIPE_ID", "RecipeDetail.aspx?ID={0}") %>'>
                            <%# DataBinder.Eval(Container.DataItem, "REC_NAME") %></a></td>
                </tr>
                <tr>
                <td class="homePageTopRatedStars"><asp:Image ID="RecListStarsImage" runat="server" ImageUrl='<%# getBaconStars(Eval("AverageRating"))%>'
                            ToolTip='<%# "Rated: " & DataBinder.Eval(Container.DataItem, "AverageRating", "{0:0.00}") & " Bacon Strips" %>' /></td>
                </tr>
                </table>
            </td>
        </EditItemTemplate>
        <EmptyDataTemplate>
            <table runat="server" style="">
                <tr>
                    <td>
                        No data was returned.</td>
                </tr>
            </table>
        </EmptyDataTemplate>
        <EmptyItemTemplate>
<td runat="server" />
        </EmptyItemTemplate>
        <GroupTemplate>
            <tr ID="itemPlaceholderContainer" runat="server">
                <td ID="itemPlaceholder" runat="server">
                </td>
            </tr>
        </GroupTemplate>
        <InsertItemTemplate>
            <td id="Td3" runat="server" class="homePageTopRatedContainer">
                <table cellpadding="0" cellspacing="0" class="homePageTopRated">
                <tr>
                <td class="homePageTopRatedImg"><a href='<%# DataBinder.Eval(Container.DataItem, "RECIPE_ID", "RecipeDetail.aspx?ID={0}") %>'>
                            <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("REC_IMAGE") %>' CssClass="RecListThumb" /></a></td>
                </tr>
                <tr>
                <td class="homePageTopRatedRecName"><a href='<%# DataBinder.Eval(Container.DataItem, "RECIPE_ID", "RecipeDetail.aspx?ID={0}") %>'>
                            <%# DataBinder.Eval(Container.DataItem, "REC_NAME") %></a></td>
                </tr>
                <tr>
                <td class="homePageTopRatedStars"><asp:Image ID="RecListStarsImage" runat="server" ImageUrl='<%# getBaconStars(Eval("AverageRating"))%>'
                            ToolTip='<%# "Rated: " & DataBinder.Eval(Container.DataItem, "AverageRating", "{0:0.00}") & " Bacon Strips" %>' /></td>
                </tr>
                </table>
            </td>
        </InsertItemTemplate>
        <ItemTemplate>
            <td id="Td4" runat="server" class="homePageTopRatedContainer">
                <table cellpadding="0" cellspacing="0" class="homePageTopRated">
                <tr>
                <td class="homePageTopRatedImg"><a href='<%# DataBinder.Eval(Container.DataItem, "RECIPE_ID", "RecipeDetail.aspx?ID={0}") %>'>
                            <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("REC_IMAGE") %>' CssClass="RecListThumb" /></a></td>
                </tr>
                <tr>
                <td class="homePageTopRatedRecName"><a href='<%# DataBinder.Eval(Container.DataItem, "RECIPE_ID", "RecipeDetail.aspx?ID={0}") %>'>
                            <%# DataBinder.Eval(Container.DataItem, "REC_NAME") %></a></td>
                </tr>
                <tr>
                <td class="homePageTopRatedStars"><asp:Image ID="RecListStarsImage" runat="server" ImageUrl='<%# getBaconStars(Eval("AverageRating"))%>'
                            ToolTip='<%# "Rated: " & DataBinder.Eval(Container.DataItem, "AverageRating", "{0:0.00}") & " Bacon Strips" %>' /></td>
                </tr>
                </table>
            </td>
        </ItemTemplate>
        <LayoutTemplate>
            <table runat="server">
                <tr runat="server">
                    <td runat="server">
                        <table ID="groupPlaceholderContainer" runat="server" border="0" style="">
                            <tr ID="groupPlaceholder" runat="server">
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr runat="server">
                    <td runat="server" style="">
                    </td>
                </tr>
            </table>
        </LayoutTemplate>
        <SelectedItemTemplate>
            <td id="Td5" runat="server" class="homePageTopRatedContainer">
                <table cellpadding="0" cellspacing="0" class="homePageTopRated">
                <tr>
                <td class="homePageTopRatedImg"><a href='<%# DataBinder.Eval(Container.DataItem, "RECIPE_ID", "RecipeDetail.aspx?ID={0}") %>'>
                            <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("REC_IMAGE") %>' CssClass="RecListThumb" /></a></td>
                </tr>
                <tr>
                <td class="homePageTopRatedRecName"><a href='<%# DataBinder.Eval(Container.DataItem, "RECIPE_ID", "RecipeDetail.aspx?ID={0}") %>'>
                            <%# DataBinder.Eval(Container.DataItem, "REC_NAME") %></a></td>
                </tr>
                <tr>
                <td class="homePageTopRatedStars"><asp:Image ID="RecListStarsImage" runat="server" ImageUrl='<%# getBaconStars(Eval("AverageRating"))%>'
                            ToolTip='<%# "Rated: " & DataBinder.Eval(Container.DataItem, "AverageRating", "{0:0.00}") & " Bacon Strips" %>' /></td>
                </tr>
                </table>
            </td>
        </SelectedItemTemplate>
    </asp:ListView>

    <asp:SqlDataSource ID="HighestRatedSqlDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:recipeConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:recipeConnectionString.ProviderName %>" 
        SelectCommand="SELECT TOP 4 * FROM [STAT_TOTAL_AVG_RATING] ORDER BY [AverageRating] DESC, [REC_NAME] DESC">
    </asp:SqlDataSource>

    <h2 class="lessTopPadding">About MyBaconRecipe.com</h2>
    <p>This Web2.0 website is the home for anything bacon... from a simple bacon dip to delicious bacon main courses oozing that delicious greasy flavour that you love! Please do browse around and, more importantly, <a href="/Account/Register.aspx">register</a> so that you can participate more actively!</p>

</div>

    <div id="rhsPaneNarrow" style="margin-top:80px;">
        <div class="adContainer">
            <div class="icnContainer">
                <img src="/ui/icnRSSFeed.gif" /></div>
            <div class="txtContainer">
                <p class="headerCont">
                    Never Miss A Greasy Recipe!</p>
                <p class="normalCont">
                    <a href="/RSS.aspx">Subscribe To Our RSS Feed!</a></p>
            </div>
        </div>
        <div class="sideBarList">
            <div class="sideImage">
               <img src="/ui/imgSideBacon.jpg" />
            </div>
            <div class="sideBarHeader">
            <h2>Our Most Viewed Recipes<br />
            <span>...all bursting with Bacon Goodness!</span></h2>
            </div>
            <asp:GridView ID="grd_sideTopRecipesViewed" runat="server" AutoGenerateColumns="False"
                DataSourceID="statRecipeNumViewsSqlDataSource" CssClass="grd_profileRecipeStyle"
                AllowPaging="False">
                <Columns>
                    <asp:TemplateField HeaderText="Record Number">
                        <ItemTemplate>
                            <%# Container.DataItemIndex + 1 %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Recipe">
                        <ItemTemplate>
                            <div>
                                <a href='<%# DataBinder.Eval(Container.DataItem, "RECIPE_ID", "RecipeDetail.aspx?ID={0}") %>'>
                                    <%# DataBinder.Eval(Container.DataItem, "REC_NAME") %></a></div>
                        </ItemTemplate>
                        <ControlStyle CssClass="EightyWidth" />
                    </asp:TemplateField>
                </Columns>
                <HeaderStyle CssClass="notVis" />
            </asp:GridView>
            <asp:SqlDataSource ID="statRecipeNumViewsSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:recipeConnectionString %>"
                ProviderName="<%$ ConnectionStrings:recipeConnectionString.ProviderName %>" SelectCommand="SELECT TOP 10 * FROM [STAT_RECIPE_NUMVIEWS_VIEW]">
            </asp:SqlDataSource>
        </div>
        <div class="sideBarList">
            <div class="sideImage">
                <img src="/ui/icnBaconLove.jpg" style="margin-left:20px;" />
            </div>
            <div class="sideBarHeader">
                <h2>
                    Our Top 5 Contributors<br />
                    <span>...sharing Bacon Love!</span></h2>
            </div>
            <asp:GridView ID="grd_StatTopUsersRecipes" runat="server" AutoGenerateColumns="False"
                DataSourceID="StatUserNumRecipesSqlDataSource" CssClass="grd_profileRecipeStyle"
                AllowPaging="True">
                <Columns>
                    <asp:TemplateField HeaderText="Record Number">
                        <ItemTemplate>
                            <%# Container.DataItemIndex + 1 %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="User">
                        <ItemTemplate>
                            <div style="width: 200px;">
                                <a href='<%# DataBinder.Eval(Container.DataItem, "USER_UNAME", "Profile.aspx?User={0}") %>'>
                                    <%# DataBinder.Eval(Container.DataItem, "USER_FNAME")%>
                                    <%# DataBinder.Eval(Container.DataItem, "USER_LNAME")%></a></div>
                        </ItemTemplate>
                        <ControlStyle CssClass="EightyWidth" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="User">
                        <ItemTemplate>
                                    <%# DataBinder.Eval(Container.DataItem, "NumRecipes") & " recipes" %>
                        </ItemTemplate>
                        <ControlStyle CssClass="EightyWidth" />
                    </asp:TemplateField>
                </Columns>
                <HeaderStyle CssClass="notVis" />
            </asp:GridView>
            <asp:SqlDataSource ID="StatUserNumRecipesSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:recipeConnectionString %>"
                ProviderName="<%$ ConnectionStrings:recipeConnectionString.ProviderName %>" SelectCommand="SELECT TOP 5 * FROM [NUM_RECIPE_VIEW]">
            </asp:SqlDataSource>
        </div>
    </div>


</asp:Content>
